package com.dodayum;

import com.dodayum.dubbo.InitDubboRegistry;
import com.google.common.base.Throwables;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

/**
 * @author BaiYu
 * @date 2024/1/1017:23
 */
public class MyListenerClass implements ServletContextListener {
    @Override
    public void contextInitialized(ServletContextEvent servletContextEvent) {

        try {
            new InitDubboRegistry();
        } catch (Exception e) {
            System.out.println(Throwables.getStackTraceAsString(e));
            throw e;
        }

        System.out.println("**********");
        System.out.println("项目启动成功");
        System.out.println("**********");

    }

    @Override
    public void contextDestroyed(ServletContextEvent servletContextEvent) {
        System.out.println("**********");
        System.out.println("项目关闭成功");
        System.out.println("**********");
    }
}
